{template nheader.html}
<script type="text/javascript">
	$(function(){
		$("#dr_loadmore").click(function(){
			var page = $("#dr_page").val();
			var kw = $("#dr_keywords").val();
			$("#dr_loadmore").html('<img src="{MEMBER_THEME_PATH}loading.gif">');
			$.get("{$moreurl}", {page:page, kw:kw}, function(data){
				if (data != "null") {
					$("#dr_body").append(data);
					$("#dr_page").val(Number(page) + 1);
					var url = window.location.href;
					url = url.replace(/&page=[0-9]+/, '');
					history.pushState({}, "title", url+"&page="+page);
					$("#dr_loadmore").html('<i class="fa fa-refresh"></i> 加载更多');
				} else {
					$("#dr_loadmore_html").hide();
				}
			});
		});
	});


	function dr_delete(id) {
		art.dialog.confirm("<font color='red'><b>你确认要删除吗？</b></font>", function(){
			// 将表单数据ajax提交验证
			$.ajax({type: "POST",dataType:"json", url: "{dr_member_url('space/'.$dclass.'/index')}",data: {id:id, action:'delete'}, success: function(data) {
				//验证成功
				if (data.status == 1) {
					$.dialog.tips(data.code, 3, 1);
					$("#dr_row_"+id).hide();
				} else {
					$.dialog.tips(data.code, 3, 0);
				}
				art.dialog.close();
				return false;
			},
				error: function(HttpRequest, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + HttpRequest.statusText + "\r\n" + HttpRequest.responseText);
				}
			});
			return true;
		});
		return false;
	}

	function dr_remove(id) {
		var _data = $("#myform").serialize();
		if ((_data.split('ids')).length-1 <= 0) {
			$.dialog.tips("到底移动谁？您还没有选择呢", 2);
			return true;
		}
		art.dialog.confirm("<font color='red'><b>你确认要移动吗？</b></font>", function(){
			// 将表单数据ajax提交验证
			$.ajax({type: "POST",dataType:"json", url: "{dr_member_url('space/'.$dclass.'/index')}",data: _data, success: function(data) {
				if (data.status == 1) {
					$.dialog.tips(data.code, 3, 1);
					setTimeout('window.location.reload(true)', 3000); // 刷新页
				} else {
					$.dialog.tips(data.code, 3, 2);
					return true;
				}
			},
				error: function(HttpRequest, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + HttpRequest.statusText + "\r\n" + HttpRequest.responseText);
				}
			});
			return true;
		});
		return false;
	}

</script>
<input name="page" id="dr_page" type="hidden" value="{$page}" />
<div class="row">
	<div class="col-md-12">

		<div class="portlet-body">
			<div class="table-toolbar">
				<form method="get" action="">
					<input name="s" type="hidden" value="member" />
					<input name="mod" type="hidden" value="space" />
					<input name="c" type="hidden" value="{$dclass}" />
					<input name="m" type="hidden" value="index" />
					<div class="row">
						<div class="col-md-6">
							<label>
							<div class="btn-group">
								<a class="btn green" href="{dr_member_url('space/'.$dclass.'/add')}"> 发布内容
									<i class="fa fa-plus"></i>
								</a>
							</div>
							</label>
						</div>
						<div class="col-md-4 col-md-offset-2">
							<label class="text-right">
								<div class="input-group">
									<input type="text" class="form-control" id="dr_keywords" name="kw" placeholder="关键字查询" value="{$kw}">
									<span class="input-group-btn">
										<button class="btn green mysubmit" type="submit"><i class="fa fa-search"></i> 搜索</button>
									</span>
								</div>
							</label>
						</div>

					</div>
				</form>
			</div>

			<form action="" method="post" name="myform" id="myform">
				<input name="action" id="action" type="hidden" value="remove" />
				<div class="table-responsive">
					<table class="table">
						<thead>
						<tr>
							<th style="width:20px;" class="algin_r">&nbsp;</th>
							<th class="algin_l">主题</th>
							<th class="algin_l">栏目</th>
							<th class="algin_l">更新时间</th>
							<th class="algin_c">阅读数</th>
							<th class="algin_c">状态</th>
							<th class="algin_l">操作</th>
						</tr>
						</thead>
						<tbody id="dr_body">
						{template space_content_data.html}
						</tbody>
						<tr>
							<td style="padding-top:15px;padding-left:15px"><input class="toggle md-check" ck="0" type="checkbox" onclick="dr_selected2()" id="dr_select" name="dr_select"></td>
							<td colspan="22">
								<div class="row">
									<div class="col-md-2">
										<label>
										<button type="button" class="btn btn-sm btn-success" onClick="dr_remove()"><i class="fa fa-edit"></i> 移动到：</button>
											</label>
									</div>
									<div class="col-md-5">
										<label>
										{$select}
											</label>
									</div>
									<div class="col-md-5">
										&nbsp;
									</div>
								</div>
							</td>
						</tr>
					</table>
					</table>
				</div>
			</form>
		</div>


	</div>
</div>


<div class="row" id="dr_loadmore_html" style="margin-top:20px">
	<div class="col-md-offset-4 col-md-4 text-center">
		<a href="javascript:;" class="btn default btn-block" id="dr_loadmore"> <i class="fa fa-refresh"></i> 加载更多 </a>
	</div>
</div>

{if IS_MOBILE}
<div class="alert alert-info" style="margin-top: 15px">
	左右滑动表格可以查看更多的内容
</div>
{/if}
{template "nfooter.html"}